Hi,
after a missed tool change today, I ended up crashing my lathe, so I'm looking to improve my toolchange error detection. This isn't the first time motion has started without a locked turret, and I think the basic problem lies with Mach3 not responding correctly.
The toolchange sequence is handled by a Click PLC with position details sent via Modbus, along with a TCALLOW (Toolchange allowed) output from the KFlop, and a TCOK signal input to the KFlop, with Mach3 being used as the interface.
The basic process when a toolchange is requested is -
Mach activates TCALLOW to let the PLC know that it is allowed to change tool.
The new tool position is transferred via a user/oem dro and Modbus.
At this point the TCOK signal goes inactive because the requested position no longer matches the actual position.
The PLC carries out the tool change sequence, and once the requested position matches the actual position and the turret is locked, does the PLC set the TCOK signal active.
For EStop monitoring, my init.c program uses a SYSTEMOK bit that gets set during initialisation, then within an infinite loop, there are various tests to check/test system status and if any check/test fails, SYSTEMOK gets cleared, which then triggers an ESTOP within Mach along with disabling all channels.
SYSTEMOK can only be reset by re-running the init.c, i.e. once it's cleared, there is nothing within the infinite loop that can reset it.
My test for the toolchanger is simply-
if(!ReadBit(TCOK) && ReadBit(TCACTIVE)) { // we need to handle TC seperate, as we lose TCOK during a change, so as long as TCActive is set at the same time, we have nothing to worry about
ClearBit(SYSTEMOK);
}
Now when the crash occured, the TCOK signal was inactive and the TCALLOW still active, which means that because Mach thought the toolchange went OK, it started sending motion commands again, and because TCALLOW was still active, the init.c test failed to notice any issues, resulting in lots of sparks.
Mach 3 shouldn't exit the toolchange script until TCOK is active, but for some reason it does, and I have noticed very occasionally the coolant (only other output controlled via Mach3) doesn't switch of, so I suspect there is an issue with inputs/outputs being updated correctly. I'm not sure what software versions the lathe is running, as I've not updated it since the start of the year.
Regardless, I'd like to make the safety checks more robust.
I'm thinking I need to add something that either prevents X/Y motion when TCOK is not active, and/or triggers an E-Stop when TCOK is lost and X/Y axis are moving, however I'm not sure what commands, if any, are avaiable for monitoring/testing for movement.
Any suggestions?
Thanks
Moray